package Cartas;

import interfaces.Carta;

public class Cartas implements Carta{

	public int v;
	public String c;
	
	public Cartas(){}
		
	public String getColor() {
		return c;
	}

	public void setColor(String s) {
		c=s;
		
	}

	public int getValor() {
		return v;
	}

	public void setValor(int i) {
		v=i;
	}
	
	public static Cartas cartasFactory(int v, String c, String t){
		
		Cartas carta=new Cartas();
		
		if (c.equals("rojo")||c.equals("verde")||c.equals("azul")||c.equals("amarillo")||c.equals("negro")){
			if(t.equals("Aliado")){
				if(v>=1&&v<=10){
					carta=new Aliado(v,c);
				}else
					throw new IllegalArgumentException("Valor incorrecto");
				
			}else if(t.equals("Recompensa")){
				if(v>=0&&v<=4){
					carta=new Recompensa(v,c);
				}else
					throw new IllegalArgumentException("Valor incorrecto");
			}else
				throw new IllegalArgumentException("Tipo incorrecto");
		}else
			throw new IllegalArgumentException("Color incorrecto");
		
		return carta;
		
	}
	
	

}
